<template>
	<view>
		<!-- <view class="cu-bar bg-black search">
			<view>
				<scroll-view scroll-x class="bg-white nav text-left">

					<view class="cu-item" :class="0==TabCur?'text-white text-xxl cur':''" @tap="tabSelect" data-id="0">
						伦敦交易所
					</view>
					<view class="cu-item" :class="1==TabCur?'text-white text-xxl cur':''" @tap="tabSelect" data-id="1">
						Sunbit交易所
					</view>
				</scroll-view>
			</view>

			 <view class="action">
				<text class="cuIcon-more" @tap="actionSheetTap"></text>
			</view> 
		</view> -->
		<!-- A仓 -->
		<tabs :ptype1="ptype1" :ptype2="ptype2" :salename="salename" :buyname="buyname" ref="child2"></tabs>
		<!-- A仓 -->
		<!-- <view v-if="0==TabCur">

			<tabs :ptype1="ptype1" :ptype2="ptype2" :salename="salename" :buyname="buyname" ref="child2"></tabs>
		</view> -->
		<!-- B仓 -->
		<!-- <view v-if="1==TabCur">

			<contractOrderList :ptype1="ptype1" :ptype2="ptype2" :salename="salename" :buyname="buyname" ref="child" v-if="hasLogin"></contractOrderList>
		</view> -->
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	import contractOrderList from '@/components/contractOrderList.vue'
	import tabs from '@/components/a-warehouse/tabs.vue'
	export default {
		data() {
			return {
				TabCur: 0,
				scrollLeft: 0,
				menu: ['我的订单', '收款方式'],
				uri: ['/pages/user/order', '/pages/address2/address'],
			}
		},
		props: {
			ptype1: {
				type: String,
				default: () => {
					return ''
				}
			},
			ptype2: {
				type: String,
				default: () => {
					return ''
				}
			},
			buyname: {
				type: String,
				default: () => {
					return ''
				}
			},
			salename: {
				type: String,
				default: () => {
					return ''
				}
			},
		},
		components: {
			contractOrderList,
			tabs
		},
		computed: {
			...mapState({
				userinfo: state => state.user.userinfo,
				myconfig: state => state.user.myconfig
			}),
			hasLogin() {
				return this.userinfo.id ? true : false
			},
		},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
				// setTimeout(() => {
				// this.$refs.child.loadTabbars(); //刷新委托列表
				// this.$refs.child.loadNewsList('refresh');
				// }, 100)


			},
			actionSheetTap() {
				uni.showActionSheet({
					// title:'标题',
					itemList: this.menu,
					success: (e) => {
						uni.navigateTo({
							url: this.uri[e.tapIndex]
						})
					}
				})
			}
		}
	}
</script>

<style>
	.nav .cu-item.cur {
		border-bottom: 0px;
	}
</style>
